<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- 一个标签 有条件渲染某一个组件 -->
    <label for="zj1">组件1</label>
    <input type="radio" value="CommonHead1" id="zj1" v-model="name">
    <label for="zj2">组件2</label>
    <input type="radio" value="CommonHead2" id="zj2" v-model="name">
    <component :is="name"></component>
    
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp({
      data() {
        return {
          name: 'CommonHead1'
        }
      }
    });

    app.component('CommonHead1', {
      template: `
        <div>
          <h2>这是组件1</h2>  
        </div>
      `
    })
    app.component('CommonHead2', {
      template: `
        <div>
          <h2>这是组件2</h2>  
        </div>
      `
    })

    app.mount('#app')
  </script>
</body>
</html>